package org.vgou.model;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

/**
 * 
 * Copyright (c) 2011, vgou All rights reserved.
 * 
 * @since Nov 27, 2011
 * @author <a href="mailto:jason.hxx@gmail.com">jason</a>
 * @version Id: Question.java Nov 27, 2011
 * @comment 问题或者用户求购转让实体类
 * 
 */
@Entity
// 更新一个对象时,会生成动态SQL,当属性值发生变化时，才会包含到UPDATE语句中
@org.hibernate.annotations.Entity(dynamicUpdate = true, dynamicInsert = true)
@Table(name = "question")
public class Question implements Serializable {

	private static final long serialVersionUID = -817578392880502251L;

	/** 编号 **/
	@Id
	@GeneratedValue
	@Column(name="id", length=19)
	private long id;
	
	/** 关联用户 **/
	@ManyToOne(fetch=FetchType.EAGER, cascade=CascadeType.ALL)
	@JoinColumn(name="userid")
	private User user;

	/** 状态  1 系统常见问题  2 用户提问 3 求购 4 转让 **/
	@Column(name="status", length=10, nullable=false)
	private int type = 1;
	
	/** 管理员回复或解答  **/
	@Column(name="content")
	private String content;
	
	/** 提问时间  **/
	@Column(name="asktime")
	private Date askTime = new Date();
	
	/** 管理员回复或解答  **/
	@Column(name="reply")
	private String reply;

	public Question() {
		super();
	}

	public Question(long id, User user, int type, String content, Date askTime,
			String reply) {
		super();
		this.id = id;
		this.user = user;
		this.type = type;
		this.content = content;
		this.askTime = askTime;
		this.reply = reply;
	}
	
	public long getId() {
		return id;
	}

	public void setId(long id) {
		this.id = id;
	}

	public User getUser() {
		return user;
	}

	public void setUser(User user) {
		this.user = user;
	}

	public int getType() {
		return type;
	}

	public void setType(int type) {
		this.type = type;
	}

	public Date getAskTime() {
		return askTime;
	}

	public void setAskTime(Date askTime) {
		this.askTime = askTime;
	}

	public String getReply() {
		return reply;
	}

	public void setReply(String reply) {
		this.reply = reply;
	}

	public String getContent() {
		return content;
	}

	public void setContent(String content) {
		this.content = content;
	}
	
}
